package com.matt.foundation.utils;

import org.apache.commons.lang.StringUtils;

/**
 *字符串转为数组
 * Created by Ron
 * from com.matt
 * on 2018/7/31 0031.
 */
public class StringTOArray {

    /**
     * 字符串转为数组
     * @param str 备注：必须 “|”分割
     * @return
     */
    public static String[] stringToArray(String str){
        if (StringUtils.isNotBlank(str)){
            if (str.contains("|")){
                return str.split("\\|");
            }
            return  new String[]{str};
        }
        return null;
    }

}
